const page = require('./page.js');
const api = require('./api.js');
const setStoreConfigMiddleware = require('../middleware/setStoreConfig');
var express = require('express');
var router = express.Router();
var bodyParser = require('body-parser');
const { readFile } = require('@app/util/index');

// 只在页面访问时使用 setStoreConfig 中间件
router.use('/', setStoreConfigMiddleware, page);
// API 路由不使用 setStoreConfig 中间件
router.use('/api',bodyParser.json({ limit: '5000mb' }), api);
router.get('/paypal_jhpaypaypal21_sdk',  function (req, res) {
  // 返回html
  res.send(readFile('./php_pay/paypal_jhpaypaypal21.html'));
});


// router.use("/homeapi", resetHomeapi);
module.exports = router;
